package com.example.blockingQueue;

import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TransferQueue;

public class LinkedTransferQueueDemo {

	public static void main(String[] args) {
		TransferQueue<String> queue = new LinkedTransferQueue<String>();
		Thread producer = new Thread(new LinkedTransferQueueProducer(queue));
		producer.setDaemon(true);
		producer.start();
		
		for (int i = 0; i < 10; i++) {
			Thread consumer = new Thread(new LinkedTransferQueueConsumer(queue));
			consumer.setDaemon(true);
			consumer.start();

			try {
				Thread.sleep(1000);
			} catch(InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		
	}

}
